(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
is_empty(nil) → true
is_empty(cons(x, l)) → false
hd(cons(x, l)) → x
tl(cons(x, l)) → l
append(l1, l2) → ifappend(l1, l2, is_empty(l1))
ifappend(l1, l2, true) → l2
ifappend(l1, l2, false) → cons(hd(l1), append(tl(l1), l2))
Rewrite Strategy: INNERMOST
(1) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID) transformation)
Converted CpxTRS to CDT
(2) Obligation:
Complexity Dependency Tuples Problem
Rules:
is_empty(nil) → true
is_empty(cons(z0, z1)) → false
hd(cons(z0, z1)) → z0
tl(cons(z0, z1)) → z1
append(z0, z1) → ifappend(z0, z1, is_empty(z0))
ifappend(z0, z1, true) → z1
ifappend(z0, z1, false) → cons(hd(z0), append(tl(z0), z1))
Tuples:
APPEND(z0, z1) → c4(IFAPPEND(z0, z1, is_empty(z0)), IS_EMPTY(z0))
IFAPPEND(z0, z1, false) → c6(HD(z0), APPEND(tl(z0), z1), TL(z0))
S tuples:
APPEND(z0, z1) → c4(IFAPPEND(z0, z1, is_empty(z0)), IS_EMPTY(z0))
IFAPPEND(z0, z1, false) → c6(HD(z0), APPEND(tl(z0), z1), TL(z0))
K tuples:none
Defined Rule Symbols:
is_empty, hd, tl, append, ifappend
Defined Pair Symbols:
APPEND, IFAPPEND
Compound Symbols:
c4, c6
(3) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)
Use narrowing to replace
APPEND(
z0,
z1) →
c4(
IFAPPEND(
z0,
z1,
is_empty(
z0)),
IS_EMPTY(
z0)) by
APPEND(nil, x1) → c4(IFAPPEND(nil, x1, true), IS_EMPTY(nil))
APPEND(cons(z0, z1), x1) → c4(IFAPPEND(cons(z0, z1), x1, false), IS_EMPTY(cons(z0, z1)))
APPEND(x0, x1) → c4
(4) Obligation:
Complexity Dependency Tuples Problem
Rules:
is_empty(nil) → true
is_empty(cons(z0, z1)) → false
hd(cons(z0, z1)) → z0
tl(cons(z0, z1)) → z1
append(z0, z1) → ifappend(z0, z1, is_empty(z0))
ifappend(z0, z1, true) → z1
ifappend(z0, z1, false) → cons(hd(z0), append(tl(z0), z1))
Tuples:
IFAPPEND(z0, z1, false) → c6(HD(z0), APPEND(tl(z0), z1), TL(z0))
APPEND(nil, x1) → c4(IFAPPEND(nil, x1, true), IS_EMPTY(nil))
APPEND(cons(z0, z1), x1) → c4(IFAPPEND(cons(z0, z1), x1, false), IS_EMPTY(cons(z0, z1)))
APPEND(x0, x1) → c4
S tuples:
IFAPPEND(z0, z1, false) → c6(HD(z0), APPEND(tl(z0), z1), TL(z0))
APPEND(nil, x1) → c4(IFAPPEND(nil, x1, true), IS_EMPTY(nil))
APPEND(cons(z0, z1), x1) → c4(IFAPPEND(cons(z0, z1), x1, false), IS_EMPTY(cons(z0, z1)))
APPEND(x0, x1) → c4
K tuples:none
Defined Rule Symbols:
is_empty, hd, tl, append, ifappend
Defined Pair Symbols:
IFAPPEND, APPEND
Compound Symbols:
c6, c4, c4
(5) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)
Removed 2 trailing nodes:
APPEND(x0, x1) → c4
APPEND(nil, x1) → c4(IFAPPEND(nil, x1, true), IS_EMPTY(nil))
(6) Obligation:
Complexity Dependency Tuples Problem
Rules:
is_empty(nil) → true
is_empty(cons(z0, z1)) → false
hd(cons(z0, z1)) → z0
tl(cons(z0, z1)) → z1
append(z0, z1) → ifappend(z0, z1, is_empty(z0))
ifappend(z0, z1, true) → z1
ifappend(z0, z1, false) → cons(hd(z0), append(tl(z0), z1))
Tuples:
IFAPPEND(z0, z1, false) → c6(HD(z0), APPEND(tl(z0), z1), TL(z0))
APPEND(cons(z0, z1), x1) → c4(IFAPPEND(cons(z0, z1), x1, false), IS_EMPTY(cons(z0, z1)))
S tuples:
IFAPPEND(z0, z1, false) → c6(HD(z0), APPEND(tl(z0), z1), TL(z0))
APPEND(cons(z0, z1), x1) → c4(IFAPPEND(cons(z0, z1), x1, false), IS_EMPTY(cons(z0, z1)))
K tuples:none
Defined Rule Symbols:
is_empty, hd, tl, append, ifappend
Defined Pair Symbols:
IFAPPEND, APPEND
Compound Symbols:
c6, c4
(7) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)
Use narrowing to replace
IFAPPEND(
z0,
z1,
false) →
c6(
HD(
z0),
APPEND(
tl(
z0),
z1),
TL(
z0)) by
IFAPPEND(x0, x1, false) → c6(APPEND(tl(x0), x1))
(8) Obligation:
Complexity Dependency Tuples Problem
Rules:
is_empty(nil) → true
is_empty(cons(z0, z1)) → false
hd(cons(z0, z1)) → z0
tl(cons(z0, z1)) → z1
append(z0, z1) → ifappend(z0, z1, is_empty(z0))
ifappend(z0, z1, true) → z1
ifappend(z0, z1, false) → cons(hd(z0), append(tl(z0), z1))
Tuples:
APPEND(cons(z0, z1), x1) → c4(IFAPPEND(cons(z0, z1), x1, false), IS_EMPTY(cons(z0, z1)))
IFAPPEND(x0, x1, false) → c6(APPEND(tl(x0), x1))
S tuples:
APPEND(cons(z0, z1), x1) → c4(IFAPPEND(cons(z0, z1), x1, false), IS_EMPTY(cons(z0, z1)))
IFAPPEND(x0, x1, false) → c6(APPEND(tl(x0), x1))
K tuples:none
Defined Rule Symbols:
is_empty, hd, tl, append, ifappend
Defined Pair Symbols:
APPEND, IFAPPEND
Compound Symbols:
c4, c6
(9) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)
Use narrowing to replace
APPEND(
cons(
z0,
z1),
x1) →
c4(
IFAPPEND(
cons(
z0,
z1),
x1,
false),
IS_EMPTY(
cons(
z0,
z1))) by
APPEND(cons(x0, x1), x2) → c4(IFAPPEND(cons(x0, x1), x2, false))
(10) Obligation:
Complexity Dependency Tuples Problem
Rules:
is_empty(nil) → true
is_empty(cons(z0, z1)) → false
hd(cons(z0, z1)) → z0
tl(cons(z0, z1)) → z1
append(z0, z1) → ifappend(z0, z1, is_empty(z0))
ifappend(z0, z1, true) → z1
ifappend(z0, z1, false) → cons(hd(z0), append(tl(z0), z1))
Tuples:
IFAPPEND(x0, x1, false) → c6(APPEND(tl(x0), x1))
APPEND(cons(x0, x1), x2) → c4(IFAPPEND(cons(x0, x1), x2, false))
S tuples:
IFAPPEND(x0, x1, false) → c6(APPEND(tl(x0), x1))
APPEND(cons(x0, x1), x2) → c4(IFAPPEND(cons(x0, x1), x2, false))
K tuples:none
Defined Rule Symbols:
is_empty, hd, tl, append, ifappend
Defined Pair Symbols:
IFAPPEND, APPEND
Compound Symbols:
c6, c4
(11) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)
Use narrowing to replace
IFAPPEND(
x0,
x1,
false) →
c6(
APPEND(
tl(
x0),
x1)) by
IFAPPEND(cons(z0, z1), x1, false) → c6(APPEND(z1, x1))
IFAPPEND(x0, x1, false) → c6
(12) Obligation:
Complexity Dependency Tuples Problem
Rules:
is_empty(nil) → true
is_empty(cons(z0, z1)) → false
hd(cons(z0, z1)) → z0
tl(cons(z0, z1)) → z1
append(z0, z1) → ifappend(z0, z1, is_empty(z0))
ifappend(z0, z1, true) → z1
ifappend(z0, z1, false) → cons(hd(z0), append(tl(z0), z1))
Tuples:
APPEND(cons(x0, x1), x2) → c4(IFAPPEND(cons(x0, x1), x2, false))
IFAPPEND(cons(z0, z1), x1, false) → c6(APPEND(z1, x1))
IFAPPEND(x0, x1, false) → c6
S tuples:
APPEND(cons(x0, x1), x2) → c4(IFAPPEND(cons(x0, x1), x2, false))
IFAPPEND(cons(z0, z1), x1, false) → c6(APPEND(z1, x1))
IFAPPEND(x0, x1, false) → c6
K tuples:none
Defined Rule Symbols:
is_empty, hd, tl, append, ifappend
Defined Pair Symbols:
APPEND, IFAPPEND
Compound Symbols:
c4, c6, c6
(13) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)
Removed 1 trailing nodes:
IFAPPEND(x0, x1, false) → c6
(14) Obligation:
Complexity Dependency Tuples Problem
Rules:
is_empty(nil) → true
is_empty(cons(z0, z1)) → false
hd(cons(z0, z1)) → z0
tl(cons(z0, z1)) → z1
append(z0, z1) → ifappend(z0, z1, is_empty(z0))
ifappend(z0, z1, true) → z1
ifappend(z0, z1, false) → cons(hd(z0), append(tl(z0), z1))
Tuples:
APPEND(cons(x0, x1), x2) → c4(IFAPPEND(cons(x0, x1), x2, false))
IFAPPEND(cons(z0, z1), x1, false) → c6(APPEND(z1, x1))
S tuples:
APPEND(cons(x0, x1), x2) → c4(IFAPPEND(cons(x0, x1), x2, false))
IFAPPEND(cons(z0, z1), x1, false) → c6(APPEND(z1, x1))
K tuples:none
Defined Rule Symbols:
is_empty, hd, tl, append, ifappend
Defined Pair Symbols:
APPEND, IFAPPEND
Compound Symbols:
c4, c6
(15) CdtPolyRedPairProof (UPPER BOUND (ADD(O(n^1))) transformation)
Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.
IFAPPEND(cons(z0, z1), x1, false) → c6(APPEND(z1, x1))
We considered the (Usable) Rules:none
And the Tuples:
APPEND(cons(x0, x1), x2) → c4(IFAPPEND(cons(x0, x1), x2, false))
IFAPPEND(cons(z0, z1), x1, false) → c6(APPEND(z1, x1))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(APPEND(x1, x2)) = x1
POL(IFAPPEND(x1, x2, x3)) = x1
POL(c4(x1)) = x1
POL(c6(x1)) = x1
POL(cons(x1, x2)) = [4] + x1 + x2
POL(false) = 0
(16) Obligation:
Complexity Dependency Tuples Problem
Rules:
is_empty(nil) → true
is_empty(cons(z0, z1)) → false
hd(cons(z0, z1)) → z0
tl(cons(z0, z1)) → z1
append(z0, z1) → ifappend(z0, z1, is_empty(z0))
ifappend(z0, z1, true) → z1
ifappend(z0, z1, false) → cons(hd(z0), append(tl(z0), z1))
Tuples:
APPEND(cons(x0, x1), x2) → c4(IFAPPEND(cons(x0, x1), x2, false))
IFAPPEND(cons(z0, z1), x1, false) → c6(APPEND(z1, x1))
S tuples:
APPEND(cons(x0, x1), x2) → c4(IFAPPEND(cons(x0, x1), x2, false))
K tuples:
IFAPPEND(cons(z0, z1), x1, false) → c6(APPEND(z1, x1))
Defined Rule Symbols:
is_empty, hd, tl, append, ifappend
Defined Pair Symbols:
APPEND, IFAPPEND
Compound Symbols:
c4, c6
(17) CdtKnowledgeProof (EQUIVALENT transformation)
The following tuples could be moved from S to K by knowledge propagation:
APPEND(cons(x0, x1), x2) → c4(IFAPPEND(cons(x0, x1), x2, false))
IFAPPEND(cons(z0, z1), x1, false) → c6(APPEND(z1, x1))
Now S is empty
(18) BOUNDS(O(1), O(1))